#!/usr/bin/env python

import argparse
import sys
import os
import decimal
#sys.path.append("Users/roosevelt/Desktop/bayes/trunk/modules/")
sys.path.append("/home/roosevelt/Desktop/bayes/trunk/modules/")
from BayesNetwork import BayesNetwork

parser = argparse.ArgumentParser(description='Generate initial structures.')
parser.add_argument('-r', help='The path to the BN to be sampled')
parser.add_argument('-n', help='The name of the BN')


args = parser.parse_args()

path = vars(args)['r']
name = vars(args)['n']

BN = BayesNetwork()
BN.parse(path)

zero_structure = BN.generateStructureWithoutEdges(BN.BayesianNetwork.keys())
zero_structure = BN.randomParameterBNInitialization(zero_structure)

random_structure = BN.generateRandomStructure(BN.BayesianNetwork.keys(), decimal.Decimal(0.1), 4)
random_structure = BN.randomParameterBNInitialization(random_structure)
 
BN.export_encog("./"+ name +"_ini_structure_zero.eg", zero_structure)
BN.export_encog("./"+ name +"_ini_structure.eg", random_structure)